import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.SystemColor;
import java.awt.Color;
import javax.swing.GroupLayout;
import javax.swing.GroupLayout.Alignment;
import javax.swing.JLabel;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JTextField;
import javax.swing.JTextArea;
import javax.swing.LayoutStyle.ComponentPlacement;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;


public class addTask {

	private JFrame frame;
	private JTextField taskField;
	JTextArea areaDescription;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					addTask window = new addTask();
					window.frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the application.
	 */
	public addTask() {
		initialize();
	}

	/**
	 * Initialize the contents of the frame.
	 */
	private void initialize() {
		frame = new JFrame();
		frame.setBounds(100, 100, 616, 480);
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		
		JPanel addTask = new JPanel();
		addTask.setForeground(Color.BLACK);
		addTask.setBackground(SystemColor.menu);
		frame.getContentPane().add(addTask, BorderLayout.NORTH);
		
		JLabel dueDateLabel = new JLabel("Due Date:");
		
		JButton taskConfButton = new JButton("Confirm");
		taskConfButton.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
			}
		});
		
		JButton cancelButton = new JButton("Cancel");
		cancelButton.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				areaDescription.setText(null);
				//cards.show("", "");
			}
		});
		
		JLabel taskNameLabel = new JLabel("Task Name:");
		
		JLabel subjectLabel = new JLabel("Subject:");
		
		JLabel descriptionLabel = new JLabel("Description:");
		
		JComboBox<String> comboBoxSubject = new JComboBox<String>();
		
		taskField = new JTextField();
		taskField.setColumns(10);
		
		String[] dueFirst = new String[]{"January","February","March","May","June","July","August","September","October","November","December"};
		JComboBox firstDue = new JComboBox();
		for(int i=0; i<dueFirst.length; i++){
			firstDue.addItem(dueFirst[i]);
		}
		
		JComboBox secondDue = new JComboBox();
		for(int i=0; i<=31; i++){
			if(i<10)
		secondDue.addItem("0"+i);
			else
				secondDue.addItem(i);
		}
		
		JComboBox thirdDue = new JComboBox();
		for(int i=2014; i<2114; i++){
			thirdDue.addItem(i);
			}
		
		JTextArea areaDescription = new JTextArea();
		areaDescription.setForeground(Color.BLACK);
		GroupLayout gl_addTask = new GroupLayout(addTask);
		gl_addTask.setHorizontalGroup(
			gl_addTask.createParallelGroup(Alignment.LEADING)
				.addGroup(gl_addTask.createSequentialGroup()
					.addGap(72)
					.addGroup(gl_addTask.createParallelGroup(Alignment.LEADING)
						.addGroup(gl_addTask.createSequentialGroup()
							.addComponent(dueDateLabel)
							.addContainerGap())
						.addGroup(gl_addTask.createSequentialGroup()
							.addGroup(gl_addTask.createParallelGroup(Alignment.TRAILING)
								.addGroup(gl_addTask.createSequentialGroup()
									.addPreferredGap(ComponentPlacement.RELATED, 1, Short.MAX_VALUE)
									.addGroup(gl_addTask.createParallelGroup(Alignment.LEADING)
										.addComponent(taskNameLabel)
										.addComponent(subjectLabel))
									.addGap(18))
								.addGroup(gl_addTask.createSequentialGroup()
									.addComponent(descriptionLabel, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
									.addGap(18)))
							.addGroup(gl_addTask.createParallelGroup(Alignment.LEADING)
								.addComponent(comboBoxSubject, 0, 320, Short.MAX_VALUE)
								.addComponent(taskField, GroupLayout.DEFAULT_SIZE, 320, Short.MAX_VALUE)
								.addGroup(gl_addTask.createSequentialGroup()
									.addComponent(firstDue, GroupLayout.PREFERRED_SIZE, 104, GroupLayout.PREFERRED_SIZE)
									.addGap(18)
									.addComponent(secondDue, GroupLayout.PREFERRED_SIZE, 50, GroupLayout.PREFERRED_SIZE)
									.addGap(30)
									.addComponent(thirdDue, GroupLayout.PREFERRED_SIZE, 56, GroupLayout.PREFERRED_SIZE))
								.addComponent(areaDescription, GroupLayout.DEFAULT_SIZE, 320, Short.MAX_VALUE))
							.addGap(133))))
				.addGroup(gl_addTask.createSequentialGroup()
					.addGap(177)
					.addComponent(taskConfButton)
					.addGap(72)
					.addComponent(cancelButton)
					.addContainerGap(217, Short.MAX_VALUE))
		);
		gl_addTask.setVerticalGroup(
			gl_addTask.createParallelGroup(Alignment.LEADING)
				.addGroup(gl_addTask.createSequentialGroup()
					.addGap(45)
					.addGroup(gl_addTask.createParallelGroup(Alignment.BASELINE)
						.addComponent(taskNameLabel)
						.addComponent(taskField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
					.addPreferredGap(ComponentPlacement.UNRELATED)
					.addGroup(gl_addTask.createParallelGroup(Alignment.BASELINE)
						.addComponent(comboBoxSubject, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
						.addComponent(subjectLabel))
					.addGap(18)
					.addGroup(gl_addTask.createParallelGroup(Alignment.LEADING)
						.addComponent(dueDateLabel)
						.addGroup(gl_addTask.createParallelGroup(Alignment.BASELINE)
							.addComponent(firstDue, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
							.addComponent(secondDue, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
							.addComponent(thirdDue, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)))
					.addGroup(gl_addTask.createParallelGroup(Alignment.LEADING)
						.addGroup(gl_addTask.createSequentialGroup()
							.addGap(45)
							.addComponent(areaDescription, GroupLayout.PREFERRED_SIZE, 97, GroupLayout.PREFERRED_SIZE)
							.addGap(63)
							.addGroup(gl_addTask.createParallelGroup(Alignment.BASELINE)
								.addComponent(taskConfButton)
								.addComponent(cancelButton)))
						.addGroup(gl_addTask.createSequentialGroup()
							.addGap(84)
							.addComponent(descriptionLabel)))
					.addContainerGap(398, Short.MAX_VALUE))
		);
		addTask.setLayout(gl_addTask);
	}

}
